<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="vue.js"></script>
    <script src="vue-resource.min.js"></script>
    <title>Title</title>
</head>
<body>
<div id="box">
    <input type="button" value="按钮" @click="get()">
    <ul>
        <li v-for="item in users">
            id:{{item.id}}
            <br>
            username:{{item.username}}
        </li>
    </ul>
</div>
</body>
<script>
    var app = new Vue({
        el: '#box',
        data: {
            users:[]
        },
        methods:{
            get: function () {
               this.$http.post('http://api.test.com/site/login',{
                   username:'admin',
                   password:'123456'
               },{
                   emulateJSON:true
               }).then(function (res) {
                   if(res.data.status== 200){
                       this.users = res.data.data;
                   } else {
                       console.log(res.data.message);
                       console.log(res.data.data);
                   }
               },function (res) {
                   console.log(res);
               });
            }
        }
    })
</script>
</html>